package cn.tedu.staticx;

import java.util.Arrays;

public class StaticDemo1 {
    public static void main(String[] args) {
//        Person p = new Person();
//        p.name = "张三";
//        p.age = 28;
//        //p.eyeNum = 2;
//        p.eyeNum = 3;//进化 眼睛数量3 eyeNum重新赋值
//        System.out.println(p.name+","+p.age+","+p.eyeNum);
//        Person p1 = new Person();
//        p1.name = "李四";
//        p1.age = 29;
//       // p1.eyeNum = 2;
//        //p1.eyeNum = 3;
//        System.out.println(p1.name+","+p1.age+","+p1.eyeNum);
        //人类有几只眼睛
        System.out.println(Person.eyeNum);

        //调用静态方法
        Person.method();//推荐方式
        new Person().method();//不建议
    }
}
class Person{
    String name;
    int age;
    //int eyeNum = 2;//正常情况下每个Person对象的眼睛数量都为2
    static int eyeNum;
    public static void method(){
//        method1();
        new Person().method1();
        System.out.println("静态方法");
    }
    public void method1(){
        System.out.println("费静态方法method1");
    }
}
